<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <!-- meta -->
    <meta charset="utf-8" />
    <meta name='description' content='<%= config.description %>'>
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <%
      var headers = config.site_headers || [];
      for (var i = 0, l = headers.length; i < l; i++) {
    %>
      <%- headers[i] %>
    <% } %>

    <link title="RSS" type="application/rss+xml" rel="alternate" href="/rss" />

    <% if (config.site_icon) { %>
      <link rel="icon" href="<%- config.site_icon %>" type="image/x-icon" />
    <% } %>

    <!-- style -->
    <%- Loader('/public/stylesheets/index.min.css')
      .css('/public/libs/bootstrap/css/bootstrap.css')
      .css('/public/stylesheets/common.css')
      .css('/public/stylesheets/style.less')
      .css('/public/libs/code-prettify/prettify.css')
      .css('/public/stylesheets/responsive.css')
      .css('/public/stylesheets/jquery.atwho.css')
      .done(assets, config.site_static_host, config.mini_assets)
    %>
    <%- Loader('/public/index.min.js')
      .js('/public/libs/code-prettify/prettify.js')
      .js('/public/libs/jquery-2.1.0.js')
      .js('/public/libs/lodash.compat.js')
      .js('/public/libs/jquery-ujs.js')
      .js('/public/libs/bootstrap/js/bootstrap.js')
      .js('/public/libs/jquery.caret.js')
      .js('/public/libs/jquery.atwho.js')
      .js('/public/javascripts/main.js')
      .js('/public/javascripts/responsive.js')
      .done(assets, config.site_static_host, config.mini_assets)
    %>
    <% if (typeof(topic) !== 'undefined') { %>
    <title><%= topic.title %> - <%= config.name %></title>
    <% } else { %>
    <title><%= config.description %></title>
    <% } %>
    <meta content="_csrf" name="csrf-param">
    <meta content="<%= csrf %>" name="csrf-token">
  </head>
  <body>
    <!-- navbar -->
    <div class='navbar'>
      <div class='navbar-inner'>
        <div class='container'>
          <a class='brand' href='/'><%- config.site_logo || config.name %></a>
          <form id='search_form' class='navbar-search' action="/search">
            <input type='text' id='q' name='q' class='search-query span3' value=''/>
          </form>
          <ul class='nav pull-right'>
            <li><a href='/'>首页</a></li>
            <% if (typeof(current_user) !== 'undefined' &&
              current_user.messages_count) { %>
              <li>
                <a href='/my/messages'>
                  <span class='big messages_count'>
                    <%= current_user.messages_count %>
                  </span> 未读消息</a>
              </li>
            <% } %>
            <li><a href='https://github.com/cnodejs/nodeclub/wiki/'>Wiki</a></li>
            <%
            var site_navs = config.site_navs || [];
            for (var i = 0, l = site_navs.length; i < l; i++) {
              var nav = site_navs[i];
            %>
            <li><a href="<%- nav[0] %>" target="<%- nav[2] %>"><%- nav[1] %></a></li>
            <% } %>
            <% if (typeof(current_user) !== 'undefined') { %>
            <li><a href='/setting'>设置</a></li>
            <li>
              <a href='/signout' data-method="post" rel="nofollow">退出</a>
            </li>
            <% } else { %>
            <li><a href='/signup'>注册</a></li>
            <li><a href='/signin'>登录</a></li>
            <% } %>
          </ul>
          <a class="btn btn-navbar" id="responsive-sidebar-trigger">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
        </div>
      </div>
    </div>
    <div id='main'>
      <%- body %>
    </div>
    <div id='backtotop'>回到顶部</div>
    <div id='footer'>
      <div id='footer_main'>
        <div class="links">
          <a class='dark' href='/about'>关于</a>
          |
          <a class='dark' href='/faq'>FAQ</a>
          |
          <a class='dark' href='https://github.com/cnodejs/nodeclub/' target="_blank">GitHub</a>
          |
          <a class='dark' href='/rss' target="_blank">RSS</a>
        </div>
        <div class='col_fade'>
          <p>&copy; <%= "2012 - " + (new Date()).getFullYear() %> </p>
          <p>本社区为开源系统，版本: <%= config.version %> ，欢迎贡献代码</p>
          <p>本站服务器由<a href="http://www.ucloud.cn/"><img src="/public/images/ucloud.png" title="UCloud云主机" alt="UCloud云主机"
          height="28px" width="92px" /></a>
          赞助</p>
        </div>
      </div>
    </div>
    <div id="sidebar-mask"></div>
    <script defer>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', '<%=config.google_tracker_id%>', '<%= config.host %>');
      ga('send', 'pageview');

    </script>
  </body>
</html>
